
<%@ taglib prefix="c" uri="http://java.sun.com/jstl/core_rt" %>
<jsp:include page = "metadatos.jsp" flush = "True" />
<%@page contentType="text/html" pageEncoding="UTF-8"%>
<!DOCTYPE html>
<html>
    <head>
        <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
        <title>ERP Sistema Mauricio Alan Gonzalez Razo</title>
    </head>
    <body>
        <h1>Calendario Anual <c:out value="${principalCalendario.anioApuntador}"/></h1>
        <div> Perfil:  <c:out value="${principalCalendario.usuarioLogeado.name}"/> </div>
        <fieldset>
            <legend>Calendario</legend>
            <center>
                <table width="1000" height="395" border="0">
                    <c:set var="n"  value="${0}"/>
                    <tr>
                        <c:forEach items="${principalCalendario.meses}" var="mes">
                            <td><div align="center">
                                    <!-- INICIO TABLA INTERNA DE CADA MES -->
                                    <table width="200" height="171" border="1">
                                        <tr>
                                            <td colspan="7"><div align="center"><c:out value="${mes.nombreMes}"/></div>
                                                <div align="center"></div>
                                                <div align="center"></div>
                                                <div align="center"></div>
                                                <div align="center"></div>
                                                <div align="center"></div>
                                                <div align="center"></div></td>
                                        </tr>
                                        <tr>
                                            <td width="28"><div align="center">D</div></td>
                                            <td width="28"><div align="center">L</div></td>
                                            <td width="28"><div align="center">M</div></td>
                                            <td width="28"><div align="center">M</div></td>
                                            <td width="28"><div align="center">J</div></td>
                                            <td width="28"><div align="center">V</div></td>
                                            <td width="28"><div align="center">S</div></td>
                                        </tr>
                                        <c:set var="nDia" value="${0}"/>
                                        <c:if test="${mes.diaInicio==1}">  
                                            <c:set var="nDia" value="${0}"/>
                                        </c:if>
                                        <c:if test="${mes.diaInicio==2}">
                                            <c:set var="nDia" value="${1}"/>
                                            <td bgColor=#F6F9ED></td>
                                        </c:if>
                                        <c:if test="${mes.diaInicio==3}">
                                            <c:set var="nDia" value="${2}"/>
                                            <td bgColor=#F6F9ED></td>
                                            <td bgColor=#F6F9ED></td>
                                        </c:if>
                                        <c:if test="${mes.diaInicio==4}">
                                            <c:set var="nDia" value="${3}"/>
                                            <td bgColor=#F6F9ED></td>
                                            <td bgColor=#F6F9ED></td>
                                            <td bgColor=#F6F9ED></td>
                                        </c:if>
                                        <c:if test="${mes.diaInicio==5}">
                                            <c:set var="nDia" value="${4}"/>
                                            <td bgColor=#F6F9ED></td>
                                            <td bgColor=#F6F9ED></td>
                                            <td bgColor=#F6F9ED></td>
                                            <td bgColor=#F6F9ED></td>
                                        </c:if>
                                        <c:if test="${mes.diaInicio==6}">
                                            <c:set var="nDia" value="${5}"/>
                                            <td bgColor=#F6F9ED></td>
                                            <td bgColor=#F6F9ED></td>
                                            <td bgColor=#F6F9ED></td>
                                            <td bgColor=#F6F9ED></td>
                                            <td bgColor=#F6F9ED></td>
                                        </c:if>
                                        <c:if test="${mes.diaInicio==7}">
                                            <c:set var="nDia" value="${6}"/>
                                            <td bgColor=#F6F9ED></td>
                                            <td bgColor=#F6F9ED></td>
                                            <td bgColor=#F6F9ED></td>
                                            <td bgColor=#F6F9ED></td>
                                            <td bgColor=#F6F9ED></td>
                                            <td bgColor=#F6F9ED></td>
                                        </c:if>
                                        <c:forEach items="${mes.dias}" var="dia">
                                            <c:if test="${nDia >= 7}">
                                                <c:set var="nDia" value="${0}"/>
                                            </tr><tr>
                                        </c:if> 
                                        <c:set var="nDia" value="${nDia+1}"/>
                                        <td  onclick="popup('Calendario?action=eventsDay&date=<c:out value="${dia.fechaDia}"/>', 800, 500);" onMouseOver="this.bgColor='#81BEF7'" onMouseOut="this.bgColor='#FFFFFF'" bgColor=#FFFFFF><div align="center"><c:out value="${dia.numeroDia}"/></div></td>
                                    </c:forEach>  
                            </table>
                        </div></td>
                        <c:set var="n" value="${n+1}"/>
                        <c:if test="${n==4}">
                            <c:set var="n" value="${0}"/>
                    </tr><tr>
                    </c:if>
                </c:forEach>
        </table>
    </center>
</fieldset>
</body>
</html>
<jsp:include page = "pie.jsp" flush = "True" />